//: Playground - noun: a place where people can play

import UIKit

class Student{
    @objc static let describe = "这是个学生类"
    @objc class func getDefaultValue() -> Int {
        return 0
    }
}

// 定义两个方法
func getDefaultValue(_ c: AnyClass) -> Int? {
    return c.getDefaultValue?()
}
func getDescribeValue(_ c: AnyClass) -> String? {
    return c.describe
}

print(getDefaultValue(Student.self) ?? "111")
print(getDescribeValue(Student.self) ?? "2222")

print(getDefaultValue(NSString.self) ?? "444")
print(getDescribeValue(NSString.self) ?? "5555")


class Student1 {
    
    var name = "333";
    required  init(){
    }
}
// 定义类的类型变量
let  StudentType: Student1.Type = Student1.self
//  AnyClass 可以接受任何类的类型
let type: AnyClass =  Student1.self

let stu = StudentType.init()
print(stu.name)

protocol TeacherDelegate {
}

class Teacher:TeacherDelegate{
}

let teacherType = Teacher.self
func isStudentDelegate(_ type:AnyClass)->Bool{
    if type is TeacherDelegate.Type{
        return true
    }
    return false
}

print(isStudentDelegate(teacherType))
